﻿#include "feilingdaojibenqingkuang_07.h"
#include "ui_feilingdaojibenqingkuang_07.h"

#include<QtSql>
#include<QtGui>
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlTableModel>
#include <QSqlError>

#include <QLineEdit>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QFileDialog>
#include <QTextEdit>
#include <QTextStream>
#include <QTableWidget>
#include <QXmlStreamWriter>

feilingdaojibenqingkuang_07::feilingdaojibenqingkuang_07(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::feilingdaojibenqingkuang_07)
{
    ui->setupUi(this);
    QSqlQuery query;

    //非领导职务
    query.exec("SELECT COUNT(1) FROM Post WHERE  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='111'  AND ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='121'  AND ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='122' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  RankID='131' and( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='141' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='142' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='150' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,1,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE RankID='199' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,1,new QTableWidgetItem(text));
    }


    //非领导女性
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0'  and Post.IDnum=CadreInfo.IDnum AND ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='111' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='112' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='121' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='122' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0' and Post.IDnum=CadreInfo.IDnum AND   Post.RankID='131' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE  Sex='0' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='132' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0'  and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='141' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0'  and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='142' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0'  and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='150' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0'  and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='160' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,2,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  Sex='0'  and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='199' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,2,new QTableWidgetItem(text));
    }

    //少数民族非领导
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='111' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='121' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='122' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')  ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND   Post.RankID='131' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='141' and  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='142' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='150' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,3,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE  NationID!='01' and Post.IDnum=CadreInfo.IDnum AND  Post.RankID='199' and ( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,3,new QTableWidgetItem(text));
    }

    //中共党员
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and  PoliticID='01' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='111'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='112'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='121'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='122'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='131'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='132'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='141'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='142'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='150'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM  Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,4,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo WHERE Post.IDnum=CadreInfo.IDnum and PoliticID='01' AND  Post.RankID='199'  and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,4,new QTableWidgetItem(text));
    }

    //博士
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,5,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and (AcademicDe='2' or AcademicDe like '2__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,5,new QTableWidgetItem(text));
    }


    //硕士
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and (AcademicDe='3' or AcademicDe like '3__' AND PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and (AcademicDe='2' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,6,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and (AcademicDe='3' or AcademicDe like '3__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,6,new QTableWidgetItem(text));
    }



    //学士

    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and (AcademicDe='4' or AcademicDe like '4__' )AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and (AcademicDe='4' or AcademicDe like '4__' )AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,7,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and (AcademicDe='4' or AcademicDe like '4__') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,7,new QTableWidgetItem(text));
    }


    //研究生
    //EduName='17' or EduName='14' or EduName='11'
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,8,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and (EduName='17' or EduName='14' or EduName='11') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,8,new QTableWidgetItem(text));
    }


    //大学本科
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and ( EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and ( EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and  (EduName='21' or EduName='28' )AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and  (EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and ( EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,9,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and ( EduName='21' or EduName='28') AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,9,new QTableWidgetItem(text));
    }

    //大学专科
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,10,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and  EduName='31' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,10,new QTableWidgetItem(text));
    }


    //中专及以下
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='111' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='112' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='121' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='122' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='131' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='132' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='141' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='142' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='150' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='160' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,11,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post,CadreInfo,Edu WHERE Post.IDnum=CadreInfo.IDnum and Edu.IDnum=CadreInfo.IDnum and Post.RankID='199' and  EduName>'39' AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,11,new QTableWidgetItem(text));
    }


    //任职期限两年以下
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='111'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')  ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='121'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='122' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and  RankID='131' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and  RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='141' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='142' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='150' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,12,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) <2 and  RankID='199' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,12,new QTableWidgetItem(text));
    }


    //任职2-5年
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND( PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND RankID='111'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND  RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND RankID='121'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND  RankID='122' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND  RankID='131' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND  RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND RankID='141' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND RankID='142' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND RankID='150' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,13,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >2 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <5 AND  RankID='199' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,13,new QTableWidgetItem(text));
    }


    //5-10
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND RankID='111'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND  RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND RankID='121'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND  RankID='122' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND  RankID='131' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND  RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND RankID='141' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND RankID='142' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND RankID='150' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,14,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >5 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <10 AND  RankID='199' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,14,new QTableWidgetItem(text));
    }


    //10-15
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND RankID='111'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND  RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND RankID='121'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND  RankID='122' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND  RankID='131' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND  RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND RankID='141' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND RankID='142' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND RankID='150' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,15,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >10 and TIMESTAMPDIFF(YEAR,PostTime,NOW()) <15 AND  RankID='199' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,15,new QTableWidgetItem(text));
    }



    //15以上

    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导职务
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(0,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND RankID='111'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(1,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND  RankID='112' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(2,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND RankID='121'  AND  (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(3,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND  RankID='122' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' ) ");//非领导副厅
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(4,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND  RankID='131' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导正处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(5,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND  RankID='132' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导副处
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(6,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND RankID='141' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导正科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(7,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND RankID='142' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导副科
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(8,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND RankID='150' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23') ");//非领导科员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(9,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND RankID='160' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23')");//非领导办事员
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(10,16,new QTableWidgetItem(text));
    }
    query.exec("SELECT COUNT(1) FROM Post WHERE  TIMESTAMPDIFF(YEAR,PostTime,NOW()) >15 AND  RankID='199' and (PostCategory='20' or PostCategory='21' or PostCategory='22' or PostCategory='23' )");//非领导试用期
    if(query.next()){
        QString text = query.value(0).toString();
        ui->tableWidget->setItem(11,16,new QTableWidgetItem(text));
    }






}

feilingdaojibenqingkuang_07::~feilingdaojibenqingkuang_07()
{
    delete ui;
}

void feilingdaojibenqingkuang_07::on_pushButton_clicked()
{
    QString filepath = QFileDialog::getSaveFileName(this, tr("Save as xml"),QString(), "XML files (*.xml);;");
    if (filepath.isEmpty()) {
        return;
    }
    filepath += ".xml";

    QFile file(filepath);
    if (!file.open(QFile::WriteOnly | QIODevice::Text)) {
        return;
    }

    QXmlStreamWriter writer(&file);
    writer.setAutoFormatting(true);
    writer.writeStartDocument();//版本号，默认1.0
    writer.writeStartElement("非领导基本情况");
    int row = ui->tableWidget->rowCount();
    int col = ui->tableWidget->columnCount();
    for(int i = 0; i < row; i++)
    {
        //构造行号
        QString row_tmp = "row";
        QString row_tmp1;
        row_tmp1.setNum(i);
        row_tmp.append(row_tmp1);
        writer.writeStartElement("line");
        for(int j = 0; j < col; j++)
        {
            //构造列号
            QString col_tmp = "col";
            QString col_tmp1;
            col_tmp1.setNum(j);
            col_tmp.append(col_tmp1);
            //合成具体位置信息
            QString loc_tmp;
            loc_tmp.append(row_tmp);
            loc_tmp.append(col_tmp);
            QTableWidgetItem *w = ui->tableWidget->item(i,j);
            QString val = w->text();
            writer.writeTextElement(loc_tmp, val);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
    writer.writeEndDocument();
    file.close();
}
